$(function () {
    imgSrcToggle();//调用函数
    var h =$("#carousel-example-generic").height();
    $("#canvas").height(h);
    $("#canvas").width($("#carousel-example-generic").width());
});

//写一个函数，此函数实现的功能是经过图片更改图片的src属性
function imgSrcToggle(){
    // $(".xiutu_box_content img").attr("src", "img/CameraRaw.png");
    var imgArray = ["img/CameraRaw.png","img/Photoshop.png","img/Lightroom.png","img/RAW.png","img/PsBrush.png"];
    var imgArrayNew = ["img/Photoshop.png","img/CameraRaw.png","img/PsBrush.png","img/Lightroom.png","img/RAW.png"];

    var imgElements = $(".xiutu_box_content img");
    //初始化
    for(var i = 0;i < imgArray.length;i++){
        imgElements.eq(i).attr("src",imgArray[i]);
            
    }
    // imgArray.forEach(element => {
    //     var i = imgArray.indexOf(element);
    //     imgElements.eq(i).attr("src",element);
    // });

    imgElements.hover(function () {
            // over
            //得到当前鼠标经过图片的序号
            var i =imgElements.index(this);
            imgElements.eq(i).attr("src",imgArrayNew[i]);
        }, function () {
            // out
            var i =imgElements.index(this);
            imgElements.eq(i).attr("src",imgArray[i]);
        }
    );
}